package com.pai4j.aigc.context.repository.dao;

import com.pai4j.aigc.context.entity.ChatMessageContextEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IChatMessageContextDAO extends JpaSpecificationExecutor<ChatMessageContextEntity>, JpaRepository<ChatMessageContextEntity, Long> {

    List<ChatMessageContextEntity> findBySessionIdOrderByIdDesc(String sessionId, Pageable pageable);

    List<ChatMessageContextEntity> findBySessionIdOrderByIdAsc(String sessionId, Pageable pageable);

    long countBySessionId(String sessionId);
}
